{include file="public/header" /}

    <link rel="stylesheet" href="/static/admin/css/main.css">
    <link rel="stylesheet" href="/static/admin/css/iconfont.css">



<body  class="iframe-h">
<div class="wrap-container email-wrap clearfix">
    <div class="row">
        <div class="email-edge col-lg-2">
            <dl class="email-folder">
                <dt>订单管理</dt>

                <?php $course = controller("Common");?>
                {volist name="model_fields" id="v"}
                    <dd>
                        <a href="{$url}/orderstatus/{$key}.html"><i class="iconfont {$v[1]} "></i>{$v[0]}<span class="layui-badge layui-bg-green f-r">{:$course->get_order_count($key)}</span></a>
                    </dd>
                {/volist}
            </dl>
        </div>
        <div class="col-lg-10">

            <div class="layui-fluid">
                <div class="layui-row layui-col-space15">
                    <div class="layui-col-md12">
                        <div class="layui-card">
                            <div class="email-content-title layui-form">
                                <span class="write-title">订单管理:{$model_fields[$orderstatus][0]} ({:$course->get_order_count($orderstatus)})</span>
                                <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
                                    <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
                            </div>
                            <div class="layui-card-body ">
                                <form class="layui-form layui-col-space5">
                                    <div class="layui-inline layui-show-xs-block">
                                        <input class="layui-input"  autocomplete="off" placeholder="开始日" name="start" id="start">
                                    </div>
                                    <div class="layui-inline layui-show-xs-block">
                                        <input class="layui-input"  autocomplete="off" placeholder="截止日" name="end" id="end">
                                    </div>
                                    <div class="layui-inline layui-show-xs-block">
                                        <input type="text" name="username"  placeholder="请输入用户名" autocomplete="off" class="layui-input">
                                    </div>
                                    <div class="layui-inline layui-show-xs-block">
                                        <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
                                    </div>
                                </form>

                            </div>
                            <form action="/admin/user/orderaction" method="post" id="contentForm" name="formlist" class="layui-form" onkeydown="if(event.keyCode==13) return false;">
                                <div class="layui-card-header">
                                    <button type="submit" name="act" value="alldel" onClick="return checkData();" class="layui-btn layui-btn-danger"><i class="layui-icon"></i>批量删除</button>
                                    <!--<button class="layui-btn" onclick="xadmin.open('添加用户','./articleadd.html',800,600)"><i class="layui-icon"></i>添加</button>-->
                                    <div class="fenye">条数
                                        <select>
                                            <option value="10" {if condition="$pagesizes eq 10"}selected {/if}}>10</option>
                                            <option value="20" {if condition="$pagesizes eq 20"}selected {/if}}>20</option>
                                            <option value="50" {if condition="$pagesizes eq 50"}selected {/if}}>50</option>
                                            <option value="100" {if condition="$pagesizes eq 100"}selected {/if}}>100</option>
                                        </select>
                                    </div>
                                </div>
                                <style>
                                    .fenye{
                                        width: 120px;
                                        float: right;
                                    }
                                    .fenye .layui-unselect{
                                        float: right;
                                        width: 80px;
                                    }
                                </style>
                                <div class="layui-card-body layui-table-body layui-table-main">
                                <table class="layui-table layui-form">



                                    <thead>
                                    <tr>
                                        <th><input type="checkbox" lay-filter="checkall" name="" lay-skin="primary"></th>
<!--                                        <th><input type="checkbox" name="" lay-skin="primary" lay-filter="emailAllChoose"></th>-->
                                        <th class="hidden-xs">序号</th>
                                        <th>订单号</th>
                                        <th class="hidden-xs">用户名</th>
                                        <th>标题</th>
                                        <th>是否查看</th>
                                        <th>订单状态</th>
                                        <th>创建时间</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>


                                        {volist name="list" id="v"}

                                            <tr>
                                                <td>
                                                    <input type="checkbox" class="checkid" checkid="{$v.id}" name="checkid[]" value="{$v.id}"   lay-skin="primary">
                                                </td>
                                                <td>{$v.id}</td>
                                                <td>{$v.orderid}</td>
                                                <td >{:base64_decode(get_zd_name("username","user","id=".$v['user_id']))}</td>
                                                <td >{$v.title}</td>
                                                <td>
                                                    <input type="checkbox" name="status"   lay-text="已查看|未查看" {if condition="$v['status'] eq 1"}checked {/if} lay-skin="switch">
                                                </td>
                                                <td >{$model_fields[$v.orderstatus][0]}</td>
                                                <td>
                                                    {:date("Y-m-d",$v.sendtime)}
                                                </td>

                                                <td class="td-manage">
                                                    <a title="编辑" href="/admin/user/order_add/id/{$v.id}" class="ml-5 layui-btn" style="text-decoration:none">
                                                        <i class="layui-icon">&#xe642;</i>编辑
                                                    </a>
                                                    <a title="删除" href="javasript:;" class="layui-btn-danger layui-btn layui-btn-xs" onclick="del({$v.id})" style="text-decoration:none">
                                                        <i class="layui-icon">&#xe640;</i>删除
                                                    </a>
                                                </td>
                                            </tr>
                                        {/volist}
                                    </tbody>
                                </table>
                            </div>
                            </form>

                            <div class="layui-card-body ">
                                <div class="page">
                                    {$list->render()}
                                </div>
                            </div>

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    layui.use(['form', 'laypage', 'jquery','layer','laydate'], function() {
        var form = layui.form,
            layer = layui.layer,
            laypage = layui.laypage,
            $ = layui.jquery;
        var laydate = layui.laydate;

        $(".layui-form-switch").click(function () {
            id=$(this).parent().parent().find("td").next("td").html();
            zd=$(this).prev().attr("name");
            var jsonData = {
                "id": id,
                "zd": zd,
            };
            $.ajax({
                type: "POST",
                url: "/admin/user/orderaudit",
                data: jsonData,
                dataType: "json",
                success: function(data){
                    if(data.status==0){
                        // alert(data.msg);
                        layer.msg(data.msg);
                    }else{
                        layer.msg(data.msg);
                        return false;
                    }
                },
                error:function(data) {
                    alert(data.msg);
                }
            });
        })


    });

    /*删除*/
    function del(id){

        layer.confirm('确认要删除吗？',function(index){
            //发异步删除数据
            // $(obj).parents("tr").remove();
            window.location.href="/admin/user/orderdel/id/"+id;
            layer.msg('已删除!',{icon:1,time:1000});
        });
    }

</script>



<script>

    window.onload=function(){

        $(".layui-anim dd").click(function () {
            pagesize=$(this).attr("lay-value");
            // alert(pagesize);
            window.location.href="?pagesize="+pagesize;
            // location.reload("?11");
        })
    }




    layui.use(['laydate','form'], function(){
        var laydate = layui.laydate;
        var  form = layui.form;


        // 监听全选
        form.on('checkbox(checkall)', function(data){

            if(data.elem.checked){
                $('tbody .checkid').prop('checked',true);
            }else{
                $('tbody .checkid').prop('checked',false);
            }
            form.render('checkbox');
        });
        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });
    });



</script>


</body>
</html>














